<template>
	<view class="body">
		<xk-header title="日常工作登记"></xk-header>

		<view class="list" >
			<view class="list-item header" @click="orderMore = !orderMore">
				<view>工作记录: </view>
				<image v-if="!orderMore" src="/static/up.png"></image>
				<image v-else  src="/static/down.png"></image>
			</view>
			<view v-if="orderMore" class="data-item">
				<view class="order-info">
					<view class="info-item"><view class="key">工作类型：</view>{{kwTypeMap[data.kw_type]}}</view>
					<view class="info-item"><view class="key">工作内容：</view><text>{{data.kw_content}}</text></view>
					<view class="info-item"><view class="key">是否重点事项：</view><text>{{data.is_record == '1' ? '是' : '否'}}</text></view>
					<view class="info-item"><view class="key">重要程度：</view><text>{{urgencyMap[data.urgency]}}</text></view>
					<view v-if="data.start_time == data.end_time" class="info-item"><view class="key">工作时间：</view>{{data.start_time}}</view>
					<view v-else class="info-item"><view class="key">工作时间：</view>{{data.start_time}} - {{data.end_time}}</view>
					<view v-if="data.image" class="info-item"><view class="key">工作图片：</view>
						<image-list :pics="data.image"></image-list>
					</view>

					<view v-if="data.check_result" class="info-item"><view class="key">抽查结果：</view>{{data.check_result == '10' ? '通过' : '不通过'}}</view>
					<view v-if="data.check_remark" class="info-item"><view class="key">抽查意见：</view>{{data.check_remark}}</view>
				</view>
			</view>
		</view>
		<view class="common-bottom-view">
			<view class="common-btn" @click="back">返回</view>
		</view>
		<view class="common-zw"></view>


	</view>
</template>

<script>
	import moment from 'moment'
	export default {
		data() {
			return {
				kwordId: '',
				orderMore: true,
				data: {},
				kwTypeMap: {},
				urgencyMap: {},
			};
		},
		onLoad(options) {
			this.initInfo()
			this.kwordId = options.kwordId;
			this.getData()
		},
		onUnload(){
		},
		methods:{
			back(){
				uni.navigateBack()
			},
			getData(){
				this.$api.baseData_getPmKword(this.kwordId).then((res)=>{
					this.data = res.task
				})
			},
			initInfo() {
				this.$api.baseData_getToolDataList({
					code: "PM_KWORD_KW_TYPE" + "_nostr"
				}).then(res => {
					let kwTypeMap = {}
					for(let item of res){
						kwTypeMap[item.data_value] = item.data_text
					}
					this.kwTypeMap = kwTypeMap
				})
				this.$api.baseData_getToolDataList({
					code: "PM_KWORD_URGENCY" + "_nostr"
				}).then(res => {
					let urgencyMap = {}
					for(let item of res){
						urgencyMap[item.data_value] = item.data_text
					}
					this.urgencyMap = urgencyMap
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
@import '@/common/from.scss';
</style>
